import java.util.*;

public class code3_2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String res = removeNext(str);
        if (res.length()==0) {
            System.out.println(0);
        } else {
            System.out.println(res);
        }
    }
    public static String removeNext(String str) {
        //ArrayDeque会比LinkedList在除了删除元素这一点外会快一点
        ArrayDeque<Character> deque = new ArrayDeque<>();
        for (char x:str.toCharArray()) {
            if (!deque.isEmpty()&&deque.peek()==x) {//注意这里要判空
                deque.pop();
            } else {
                deque.push(x);
            }
        }
        String S = "";
        while(!deque.isEmpty()) {
            S = deque.pop()+S;//不能直接转为字符串,转出来输出的结果是数组
        }
        return S;
    }
}
